﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VTFC
{
    // ----------------------------------------------------------------------------
    /// <summary>
    /// Metadata of document library.
    /// </summary>
    // ----------------------------------------------------------------------------
    [Serializable]
    public class List
    {
        /// <summary>ID of the list.</summary>
        public string ID { get; set; }
        /// <summary>Name of the list.</summary>
        public string Name { get; set; }
        /// <summary>Version of the list.</summary>
        public string Version { get; set; }
        /// <summary>Absolute url of the list.</summary>
        public string Url { get; set; }
        /// <summary>Directory in local disc.</summary>
        public string Directory { get; set; }
        /// <summary>TFS folder container.</summary>
        public List<Folder> Folders { get; set; }

        // ----------------------------------------------------------------------------
        /// <summary>
        /// Constructor.
        /// </summary>
        // ----------------------------------------------------------------------------
        public List()
        {
        }//ctor 

        // ----------------------------------------------------------------------------
        /// <summary>
        /// Search a <see cref="VTFC.Folder"/> in Folders.
        /// </summary>
        /// <param name="url">Full url of the folder.</param>
        /// <returns><see cref="VTFC.Folder"/> instance if it exists.</returns>
        // ----------------------------------------------------------------------------
        public Folder GetFolderByUrl(string url)
        {
            return Folders.Find(f => f.Url.Equals(url));
        }//func GetFolderByUrl
    }//class List
}//namespace VTFC
